<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2.3.v-on指令</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="v-on指令" v-on:click="doIt">
        <input type="button" value="v-on简写@" @click="easy">
        <input type="button" value="双击事件" @dblclick="dbl">
        <h2 @click="changeFood">{{food}}</h2>
    </div>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                food: "西蓝花",
            },
            methods: {
                doIt: function () {
                    alert("methods,v-on:click=doIt");
                },
                easy: function () {
                    alert(" @click=doIt");
                },
                dbl: function () {
                    alert("@dblclick=dbl");
                },
                changeFood: function () {
                    // console.log(this.food);
                    this.food += "好好吃";
                }
            },
        });
    </script>
</body>

</html>